package demo4;
class A {
    public int a;
    public int b;
    public int d = 20;

    public void funcA() {
        System.out.println("这是父类的成员方法");
    }
}
class B extends A {

    public int c;
    public int d = 21;

    public void funcA(int i) {
        System.out.println("子类与父类同名的方法");
    }
    public void funcB() {
        System.out.println("这是子类的成员方法");
    }
    public void funcC() {
        funcA();//访问父类继承的funcA()
        funcB();//访问子类自己的funcB()
        funcA(20);//传参，访问子类中的funcA方法
    }

    public void func() {
        int a = 10;
        int b = 11;
        System.out.println(a);
        System.out.println(b);
        System.out.println(c);
        System.out.println(d);

        System.out.println("==============");
        System.out.println(super.a);//访问父类的a
        funcA();
        super.funcA();//访问父类的funcA


    }
}
public class Test5 {
    public static void main(String[] args) {
        B b = new B();
        b.func();

    }
}
